package com.wanlian.netty.File.msg.util;

import com.wanlian.json.JsonStringUtil;
import com.wanlian.netty.File.model.FileDeleteModel;
import com.wanlian.netty.File.model.FileRenameModel;
import com.wanlian.netty.File.msg.FileBaseMsg;
import com.wanlian.netty.msg.MsgType;

//文件重命名
public class FileRenameMsg extends FileBaseMsg {
    private FileRenameModel fileRenameModel;

    public FileRenameMsg(String data){
        this.setFileRenameModel(JsonStringUtil.readValue(data, FileRenameModel.class));
        this.setType(MsgType.DEVICE_FILE_RENAME_REQ);
    }

    public FileRenameModel getFileRenameModel() {

        return fileRenameModel;
    }

    public void setFileRenameModel(FileRenameModel fileRenameModel) {
        this.fileRenameModel = fileRenameModel;
        this.getBaseHead().setTagClientId(fileRenameModel.getDeviceKey());
        this.setContent(JsonStringUtil.writeValueAsString(this.fileRenameModel));
    }
}
